<!DOCTYPE html>
<html lang="en">

<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <meta name="viewport"
        content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0,user-scalable=no" />
    <meta name="format-detection" content="telephone=no" />
    <meta name="format-detection" content="email=no" />
    <meta http-equiv="Pragma" content="no-cache" />
    <meta http-equiv="Cache-Control" content="no-cache" />
    <meta http-equiv="Expires" content="0" />
    <title>糖尿病风险评估</title>
    <!-- 引入 vant UI 组件库样式文件 -->
    <link rel="stylesheet" href="../../../common/css/vant-index.css" />
    <style rel="stylesheet">
        body {
            background-color: #f7f8fa;
        }

        a {
            -webkit-tap-highlight-color: rgba(0, 0, 0, 0);
        }

        a:-webkit-any-link {
            color: #eee;
        }

        h5 {
            margin-left: 1rem;
        }

        .container {
            border: 1px solid #f5f5f5;
            box-shadow: -1px 5px 5px #ececec;
            border-radius: 10px;
            margin: 0.6rem;
            padding: 0;
            height: 680px;
            position: relative;
        }

        .van-cell__title {
            flex: 2;
        }

        #lists {
            margin-top: 0.2rem;
            font-size: 1rem;
            font-weight: 350;
            color: #8c8b8c;
            text-align: left;
        }

        .van-cell-group--inset {
            margin: 0;
        }

        .tab-btn {
            margin: 0.2rem;
            height: 1.7rem;
            line-height: 1.7rem;
        }

        #tabs-title {
            background-color: #11428c;
            display: flex;
        }

        #left-btn {
            flex: 1;
        }

        #right-btn {
            margin-right: 0.5rem;
        }

        h4 {
            text-decoration: underline;
            margin-left: 1rem;
        }

        .evalution_text {
            display: block;
            margin: 1rem;
        }

        .evalution_title {
            text-align: center;
            display: block;
        }

        .evalution_img {
            width: 100%;
            height: 60%;
        }

        .evalution_value {
            bottom: 0;
            height: 3rem;
            width: 100%;
            background-color: #E22E30;
            text-align: center;
            line-height: 3rem;
            position: absolute;
            bottom: 0;
            margin-bottom: 0.5rem;


        }

        .evalution_style {
            margin: 1rem;
        }
    </style>
</head>

<body>
    <div id="app" v-cloak>
        <van-nav-bar v-if='from!="weapp"' title="糖尿病风险评估" left-text="返回" left-arrow @click-left="onClickLeft" @click-right="onClickRight">
            <template #right>
                <van-icon name="wap-home-o" size='18' />
            </template>
        </van-nav-bar>
        <div class="container" :class="from=='weapp'?'margin-bottom':''">
            <div class="evalution_style">
                <img class="evalution_img" src="../../img/evalution/diabetes.png" alt="">
                <span class="evalution_title">糖尿病风险评估</span>
            </div>
            <span class="evalution_text">
                糖尿病风险评估主要用于评估患者当前患病风险程度和未来10年内2型唐标兵的患病几率。该量表包含7个自评条目，帮助患者了解自己患病风险。通过加强运动、合理膳食，可以有效地控制糖尿病患病风险，降低糖尿病发生的几率。</span>
            <div v-if="list.output">
				<a v-if='from=="weapp"' :href="'./diabetes.html?status=1&from=weapp&pid='+patientId" style="color: black;">
				    <h4>评估结果</h4>
				    <h5>填写时间:{{this.list.createTime}}</h5>
				    <span class="evalution_text" v-html="list.output"></span>
				</a>
                <a v-else href="./diabetes.html?status=1" style="color: black;">
                    <h4>评估结果</h4>
                    <h5>填写时间:{{this.list.createTime}}</h5>
                    <span class="evalution_text" v-html="list.output"></span>
                </a>
            </div>
            <a :href="'./diabetes.html?from=weapp&pid='+patientId" v-if='from=="weapp"'>
                <div class="evalution_value" style="background-color: #005BAC;">
                    {{this.value}}
                </div>
            </a>
			<a href="./diabetes.html" v-else>
                <div class="evalution_value">
                    {{this.value}}
                </div>
            </a>
        </div>
    </div>
</body>
<!-- 上线环境用 -->
<script src=" ../../../common/js/vue.global.prod.js">
</script>
<!-- 引入 UI 组件库 -->
<script src="../../../common/js/vant.min.js"></script>
<!-- axios 接口调用 -->
<script src="../../../common/js/axios.min.js"></script>
<script src="../../../base.js"></script>
<script src="../../../common/js/url.min.js"></script>


<script type="module">
    import {
        getAction,
        postAction,
        getUrl,
    } from "../../../common/js/api/vue3-axios-utils.js";
    const PatientData = {
        data() {
            return {
                url: {
                    getDiabetesInfo: "/105/26/1052602",
                },
                radio: '',
                list: [],
                value: '立即评估',
				patientId:''
            };
        },
        created() {
			if(url('?from')=='weapp'){
				this.from = 'weapp'
			}
			if(url('?pid')){
				this.patientId = url('?pid')
			}else{
				this.patientId = localStorage.pid;
			}
            this.getData().catch((error) => {
                console.log(error);
            });

        },

        methods: {
            async getData() {
                let patientId = this.patientId
                // let patientId = 10000;



                let url =
                    getUrl() + this.url.getDiabetesInfo + "?patientId=" + patientId;

                const res = await getAction(url);

                if (res.data.success) {
                    this.list = await res.data.result;
                    console.log(this.list);
                    if (this.list.output !== null) {
                        this.value = '再次评估'
                    }

                }
            },
            onClickLeft() {
                window.location.href = '../../evalutionIndex.html'
            },
            onClickRight() {
                window.location.href = '../../index.html?userid=' + localStorage.pid
            },

        },
    };

    const app = Vue.createApp(PatientData);

    app.use(vant);

    // 通过 CDN 引入时不会自动注册 Lazyload 组件
    // 可以通过下面的方式手动注册
    app.use(vant.Lazyload);

    // 调用函数组件，弹出一个 Toast
    // vant.Toast("刷新成功");

    app.mount("#app");
</script>

</html>